home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / security / Watcher / hist_key.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-06-26  |  882 b   |  41 lines

  1. /*
  2.    hist_key: a key has been found in the history file.  After error
  3.    checking, set up the list structure for the key.
  4.  
  5.    Kenneth Ingham
  6.  
  7.    Copyright (C) The University of New Mexico
  8. */
  9.  
  10. #include "defs.h"
  11.  
  12. hist_key(line, cmd_ptr, key_ptr, value_ptr)
  13. char *line;
  14. struct old_cmd_st **cmd_ptr;
  15. struct key_st **key_ptr;
  16. struct val_st **value_ptr;
  17. {
  18.     if (*cmd_ptr == NULL) {
  19.         printf("Bad history file: keyword found before pipeline.\n");
  20.         printf("Ignoring history file.\n");
  21.         return FAIL;
  22.     }
  23.  
  24.     /* is this the first key for this command? */
  25.     if ((*cmd_ptr)->keys == NULL) {
  26.         (*cmd_ptr)->keys = allocate(struct key_st);
  27.         *key_ptr = (*cmd_ptr)->keys;
  28.     }
  29.     else {
  30.         (*key_ptr)->next = allocate(struct key_st);
  31.         *key_ptr = (*key_ptr)->next;
  32.     }
  33.  
  34.     (*key_ptr)->next = NULL;
  35.     (*key_ptr)->vals = NULL;
  36.     (*key_ptr)->key_value = strsave(&line[1]);
  37.     *value_ptr = NULL;
  38.  
  39.     return SUCCESS;
  40. }
  41.